﻿#region Usings

using System.Data.Entity.ModelConfiguration;
using Rail.Net.Core.Model;

#endregion

namespace Rail.Net.Data.Configuration
{
    public class DiscountOptionMap : EntityTypeConfiguration<DiscountOption>
    {
        public DiscountOptionMap()
        {
            ToTable("DiscountOptions");
            HasKey(discountOption => discountOption.Id);

            Property(discountOption => discountOption.Type).IsRequired();
            Property(discountOption => discountOption.Name).IsRequired().HasMaxLength(30);

            HasMany(discountOption => discountOption.Travelers).WithOptional(traveler => traveler.DiscountOptions);
        }
    }
}